﻿@model ConferenceLocaleModel
@{
	ViewBag.Title = Resources.ConferenceLocale + ConstValues.strDash + ViewBag.ConferenceName;
}
<div id="menuBar" style="height:35px;">
	<div style="float: left; padding: 5px 5px; font-weight: bold; text-align: left;">
		@Resources.IsPaid：<select id="selPaidStatus" class="easyui-combobox" style="height:27px; width:200px;" data-options="editable:false,panelHeight:'auto'">
			<option value="">@Resources.All</option>
			<option value="@ConstValues.PaidStatus.已缴费">@Resources.HasPaid</option>
			<option value="@ConstValues.PaidStatus.未缴费">@Resources.HasNotPaid</option>
			<option value="@ConstValues.PaidStatus.退款">@Resources.Refunded</option>
		</select>&nbsp;&nbsp;
		@Resources.IsArriveOrNot：<select id="selArriveStatus" class="easyui-combobox" style="height:27px; width:200px;" data-options="editable:false,panelHeight:'auto'">
			<option value="">@Resources.All</option>
			<option value="@ConstValues.GenericSelectionType.有">@Resources.IsArrived</option>
			<option value="@ConstValues.GenericSelectionType.无">@Resources.IsNotArrived</option>
		</select>&nbsp;&nbsp;
		@Resources.HasDinnerOrNot：<select id="selDinnerStatus" class="easyui-combobox" style="height:27px; width:200px;" data-options="editable:false,panelHeight:'auto'">
			<option value="">@Resources.All</option>
			<option value="@ConstValues.GenericSelectionType.有">@Resources.Yes</option>
			<option value="@ConstValues.GenericSelectionType.无">@Resources.No</option>
		</select>&nbsp;&nbsp;
		@Resources.NeedInvoiceOrNot：<select id="selInvoiceStatus" class="easyui-combobox" style="height:27px; width:200px;" data-options="editable:false,panelHeight:'auto'">
			<option value="">@Resources.All</option>
			<option value="@ConstValues.GenericSelectionType.有">@Resources.Yes</option>
			<option value="@ConstValues.GenericSelectionType.无">@Resources.No</option>
		</select>	
	</div>
	<div class="clear"></div>
</div>
<div id="menuBar" style="height:35px;">
	<div style="float: left; padding: 5px 5px; font-weight: bold; text-align: left;">
		@Resources.PaidType：<select id="selPaidType" class="easyui-combobox" style="height:27px; width:200px;"></select>&nbsp;&nbsp;
		@Resources.AttendenceId：&nbsp;&nbsp;&nbsp;<input id="selId" class="easyui-textbox" style="height:27px; width:200px;" />&nbsp;&nbsp;
		@Resources.FullName/@Resources.Telephone/@Resources.Mobile/@Resources.Mail/@Resources.Affiliation：<input id="selSearchId" class="easyui-textbox" style="height:27px; width:200px;" />&nbsp;&nbsp;
		<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-search" onclick="searchData();">@Resources.Search</a>&nbsp;&nbsp;
	</div>
	<div class="clear"></div>
</div>
<div id="menuBar" style="height:35px;">
	<div style="float: left; padding: 5px 5px; font-weight: bold; text-align: left;">
	@if ((User as ICISPrincipal).IsSSA || (User as ICISPrincipal).CSAList.Contains(Model.ConferenceId) || Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceLocaleRegister, RoleType.添加))
	 {
		<text>
		<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-redo" onclick="localeManage();" plain="true">@Resources.ConferenceLocale</a>
		<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-download" onclick="downloadImportTemplate();" plain="true">@Resources.InvoiceTemplateDownLoad</a>
		<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-import" onclick="openImport();" plain="true">@Resources.Import</a>
		</text>
	}
	</div>
	<iframe id="iframeDownload" style="width:0; height:0; visibility:hidden" tabindex="-1"></iframe>
	<div class="clear"></div>
</div>
<div id="dataGrid"></div>

@section bodyParts {
<!-- 现场管理 -->
<div id="detailWindow" class="easyui-window"
	title="@Resources.ConferenceLocale" data-options="closed:true,minimizable:false,iconCls:'icon-save'"
	style="width:600px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<h3 id="detailWindowTitle" class="tit01">@Resources.LocaleManage</h3>
			<form id="frmDetail" method="post">
				@Html.AntiForgeryToken()
				<table width="100%" height="100%" id="tblDetail" cellpadding="0" cellspacing="1" border="0" class="tastyle01">
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.AttendenceId：</td>
						<td style="text-align: left;" class="w2 c2">
							<input type="hidden" id="hidConferenceId" name="conferenceId" />
							<input type="hidden" id="hidAttendId" name="id" />
							<input id="txtId" name="id" oninput="scan();" maxlength="22" class="m-textbox" style="height:27px; width:293px;border: 1px solid #CCC;height: 25px;line-height: 25px;padding-left: 5px;color: #333;font-size: 16px;border-radius:5px" required="required" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.FullName：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="fullName" name="fullName" class="easyui-textbox" style="height:27px; width:300px;" data-options="editable:false,required:true" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.PaymentShouldPay：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="paymentShouldPay" name="TotalFee" class="easyui-textbox" style="height:27px; width:300px;" data-options="editable:false,required:true" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.PaymentHasPay：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="paymentHasPay" name="ActuallyFee" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.PaymentType：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="paymentType" name="PaymentType" class="easyui-combobox" style="height:27px; width:300px;" data-options="editable:false,required:true">
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.PayStatus：</td>
						<td style="text-align: left;" class="w2 c4">
							<select id="payStatus" name="PayStatus" class="easyui-combobox" style="height:27px; width:300px;" data-options="editable:false,required:true,panelHeight:'auto'">
								<option value="@ConstValues.PaidStatus.已缴费">@Resources.HasPaid</option>
								<option value="@ConstValues.PaidStatus.未缴费">@Resources.HasNotPaid</option>
								<option value="@ConstValues.PaidStatus.退款">@Resources.Refunded</option>
							</select>
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.ArriveStatus：</td>
						<td style="text-align: left;" class="w2 c2">
							<select id="arriveStatus" name="ArriveStatus" class="easyui-combobox" style="height:27px; width:300px;" data-options="editable:false,required:true,panelHeight:'auto'">
								<option value="@ConstValues.GenericSelectionType.有">@Resources.IsArrived</option>
								<option value="@ConstValues.GenericSelectionType.无">@Resources.IsNotArrived</option>
							</select>
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.DinnerStatus：</td>
						<td style="text-align: left;" class="w2 c4">
							<select id="dinnerStatus" name="DinnerStatus" class="easyui-combobox" style="height:27px; width:300px;" data-options="editable:false,required:true,panelHeight:'auto'">
								<option value="@ConstValues.GenericSelectionType.有">@Resources.Yes</option>
								<option value="@ConstValues.GenericSelectionType.无">@Resources.No</option>
							</select>
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.AttendCard：</td>
						<td style="text-align: left;" class="w2 c2">
							<select id="attendCardPrint" name="AttendCardPrint" class="easyui-combobox" style="height:27px; width:300px;" data-options="editable:false,required:true,panelHeight:'auto'">
								<option value="@ConstValues.GenericSelectionType.有">@Resources.CardHasPrint</option>
								<option value="@ConstValues.GenericSelectionType.无">@Resources.CardHasNotPrint</option>
							</select>
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.InvoiceNum：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="invoiceNum" name="InvoiceNum" class="easyui-textbox" style="height:27px; width:300px;" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right; " class="w1 c3">@Resources.Remark：</td>
						<td style="text-align: left;" class="w2 c4" colspan="3">
							<input id="remark" name="remark" class="easyui-textbox" style="height:50px; width:300px;" data-options="multiline:true, validType:['length[1,1000]']" />
						</td>
					</tr>
				</table>
			</form>
			<div class="btnDiv">
				<input type="hidden" id="hdnWindowType" />
				<input type="button" class="sbtn" onclick="printData();" value="@Resources.Print" />&nbsp;&nbsp;
				<input type="button" class="gbtn" onclick="saveData();" value="@Resources.Save" />&nbsp;&nbsp;
				<input type="button" class="rbtn" onclick="$('#detailWindow').window('close');" value="@Resources.Cancel" /><br /><br />
				&nbsp;<input type="button" class="lbtn" id="btnMail" onclick="sendMail();" value="@Resources.SaveAndSend" />&nbsp;
			</div>
		</div>
	</div>
</div>
<!-- 发票管理 -->
<div id="invoiceWindow" class="easyui-window"
	title="@Resources.ConferenceLocale" data-options="closed:true,minimizable:false,iconCls:'icon-save'"
	style="width:600px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<h3 id="i-detailWindowTitle" class="tit01">@Resources.InvoiceManage</h3>
			<form id="invoiceDetail" method="post">
				@Html.AntiForgeryToken()
				<table width="100%" height="100%" id="tblDetail" cellpadding="0" cellspacing="1" border="0" class="tastyle01">
					<tr>
						<td style="text-align: right; " class="w1 c1">@Resources.InvoiceStatus：</td>
						<td style="text-align: left;" class="w2 c2  check_fl" colspan="3">
							<input id="i-hidConferenceId" name="ConferenceId" type="hidden" />
							<input id="i-hidId" name="Id" type="hidden" />
							<span id="hasInvoiced">
								<input type="radio" name="HasInvoiced" value="true"><span>已开票</span>
								<input type="radio" name="HasInvoiced" value="false"><span>未开票</span>
							</span>
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.InvoiceTitle：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtInvoiceTitle" name="InvoiceTitle" class="easyui-combobox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.TaxNum：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtTaxNum" name="TaxNum" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.Bank：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtBank" name="Bank" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.BankAccount：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtBankAccount" name="BankAccount" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.AddressAndTel：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtAddressAndTel" name="AddressAndTel" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,200]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.InvoiceType：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtInvoiceType" name="InvoiceType" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.InvoiceClass：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtInvoiceClass" name="InvoiceClass" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.InvoiceDate：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtInvoiceDate" name="InvoiceDate" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.InvoiceCode：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtInvoiceCode" name="InvoiceCode" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.InvoiceNo：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtInvoiceNum" name="InvoiceNum" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.InvoiceAmount：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtInvoiceAmount" name="InvoiceAmount" class="easyui-numberbox" style="height:27px; width:300px;" data-options="min:0,precision:2"/>
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.InvoiceAddress：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtInvoiceAddress" name="InvoiceAddress" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,200]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.InvoiceReceive：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtInvoiceReceive" name="InvoiceReceive" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.InvoiceTel：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtInvoiceTel" name="InvoiceTel" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.InvoiceExpress：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtInvoiceExpress" name="InvoiceExpress" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,200]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.InvoiceMail：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtInvoiceMail" name="InvoiceMail" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
					</tr>
				</table>
			</form>
			<div class="btnDiv">
				<input type="hidden" id="i-hdnWindowType" />
				<input type="button" class="gbtn" onclick="saveInvoice();" value="@Resources.Save" />&nbsp;&nbsp;
				<input type="button" class="rbtn" onclick="$('#invoiceWindow').window('close');" value="@Resources.Cancel" />
			</div>
		</div>
	</div>
</div>
<!-- 查看费用明细 -->
<div id="paymentDetailWindow" class="easyui-window"
	title="@Resources.ConferenceLocale" data-options="closed:true,minimizable:false,maximizable:false,iconCls:'icon-save'"
	style="width:1200px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<h3 id="paymentDetailWindowTitle" class="tit01"></h3>
			<div id="paymentDataGrid"></div>
		</div>
	</div>
</div>
<!-- 打印预览 -->
<div id="printView" class="easyui-window"
	title="@Resources.Print" data-options="closed:true,minimizable:false,iconCls:'icon-save'"
	style="width:800px; display:none; overflow-x:hidden; overflow-y:hidden;">
	<iframe id="p-iframe" style="height:100%; width:100%;"></iframe>
</div>
<!-- 个人参会信息打印预览 -->
<div id="profilePrintView" class="easyui-window"
	title="@Resources.CheckAttendConferenceInfo" data-options="closed:true,minimizable:false,maximizable:false,iconCls:'icon-save'"
	style="width:1200px; display:none; overflow-x:hidden; overflow-y:hidden;">
	<iframe id="profile-iframe" style="width:100%;height:100%"></iframe>
</div>
<!-- 导入开票信息 -->
<div id="importWindow" class="easyui-window"
     title="@Resources.Import @Resources.InvoiceInfo" data-options="closed:true,minimizable:false,iconCls:'icon-save'"
     style="width:600px; display:none;">
	<div class="popupDiv">
		<form id="frmImport" method="post" enctype="multipart/form-data">
			@Html.AntiForgeryToken()
			<input type="hidden" id="hidIptConferenceId" name="ConferenceId" />
			<input id="importFile" name="ImportFile" class="easyui-filebox" style="height:27px; width:500px;" data-options="required:true, prompt:'@Resources.Import', buttonText:'@Resources.Upload', accept:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'" />
		</form>
		<div class="buttonDiv">
			<input type="button" class="btn lbtn" onclick="importData();" value="@Resources.Import" />&nbsp;&nbsp;
			<input type="button" class="btn rbtn" onclick="$('#importWindow').window('close');" value="@Resources.Cancel" />
		</div>
	</div>
</div>
}

@section Scripts {
<script>
	common.setCurrentMenu("ConferenceLocale");

	$(function () {
		$("#hidConferenceId").val("@Model.ConferenceId");

		var orgCount = 0;
		$("#selPaidType").combobox({
			editable: false,
			valueField: "id",
			textField: "name",
			url: "@Url.Action(nameof(UtilityController.GetPayTypeWithAll),
					nameof(UtilityController).GetControllerName())" + "?conferenceId=" + $("#hidConferenceId").val(),
			onLoadSuccess: function(data) {
				orgCount = data.length;
			},
			onShowPanel: function () {
				if (orgCount < 10) {
					$(this).combobox("panel").height("auto");
				} else {
					$(this).combobox("panel").height(200);
				}
			},
		});

		$("#selId").textbox("textbox").bind("keydown", function (e) {
			if (e.keyCode == 13) {
				searchData()
			}
		});

		$("#selSearchId").textbox("textbox").bind("keydown", function (e) {
			if (e.keyCode == 13) {
				searchData()
			}
		});

		$("#dataGrid").datagrid({
			url: "@Url.Action(nameof(ConferenceLocaleController.GetData),
					nameof(ConferenceLocaleController).GetControllerName())",
			method: "get",
			singleSelect: true,
			fitColumns: false,
			width: $(window).width() - 285,
			height: $(window).height() - 238,
			nowrap: false,
			pagination: true,
			remoteSort:true,
			pageSize: @ConstValues.DefaultGridRows,
			striped: true,
			toolbar: "#toolBar",
			pageSize: 100,
			pageList: [100, 200, 300, 400, 500],
			frozenColumns: [[
				@if ((User as ICISPrincipal).IsSSA || (User as ICISPrincipal).CSAList.Contains(Model.ConferenceId) ||
					Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceLocaleRegister, RoleType.添加) ||
					Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceLocaleRegister, RoleType.修改))
				{
					<text>
					{
						field: "operate", title: "@Resources.Operate", align: "center", width: 320,
						formatter: function(value, rec) {
							var strInfo = "";
							@if ((User as ICISPrincipal).IsSSA || (User as ICISPrincipal).CSAList.Contains(Model.ConferenceId) || Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceLocaleRegister, RoleType.添加))
							{
								<text>
								strInfo += "<a href='#' style='color:#66CDAA;font-weight:bold;text-decoration:underline;' onclick='localeManageById(\""
									+ rec.id + "\")'>@Resources.LocaleManage</a>";
								</text>
							}
							@if ((User as ICISPrincipal).IsSSA || (User as ICISPrincipal).CSAList.Contains(Model.ConferenceId) || Utility.HasConferenceRole((User as ICISPrincipal), Model.ConferenceId, ConstValues.FunctionId.ConferenceLocaleRegister, RoleType.修改))
							{
								<text>
								if (strInfo != "") {
									strInfo += "&nbsp;|&nbsp;";
								}
								strInfo += "<a href='#' style='color:#DC143C;font-weight:bold;text-decoration:underline;' onclick='invoiceManageById(\""
									+ rec.id + "\")'>@Resources.InvoiceManage</a>";
								</text>
							}
							return strInfo;
						}
					},
					</text>
				}
			]],
			columns: [[
				{ field: "id", title: "@Resources.AttendenceId", align: "center", sortable: true, width: 200 },
				{
					field: "fullName", title: "@Resources.FullName", align: "center", sortable: true, width: 200,
					formatter: function (value, rec) {
						var strInfo = "<a href='#' style='color:#1874CD;text-decoration:underline;' onclick='printPersonData(\"" + rec.id + "\")'>" + value + "</a>  ";
				    		return strInfo;
					}
				},
				{ field: "affiliation", title: "@Resources.Affiliation", align: "center", sortable: true, width: 300 },
				{ field: "attendenceIdentityId", title: "@Resources.AttendenceIdentity", align: "center", sortable: true, width: 150 },
				{
					field: "totalFee", title: "@Resources.PaymentShouldPay", align: "center", sortable: true, width: 150,
					formatter: function (value, rec) {
				    		if (value != null) {
				    			var strInfo = "<a href='#' style='color:#66CDAA;font-weight:bold;text-decoration:underline;' onclick='checkPaymentDetail(\"" + rec.id + "\")'>" + value + "</a>  ";
				    			return strInfo;
				    		} else {
				    			return "@ConstValues.strHyphen@ConstValues.strHyphen";
				    		}
					}
				},
				{ field: "actuallyFee", title: "@Resources.PaymentHasPay", align: "center", sortable: true, width: 150},
				{ field: "payType", title: "@Resources.PaymentType", align: "center", sortable: true, width: 150 },
				{ field: "hasPaid", title: "@Resources.PayStatus", align: "center", sortable: true, width: 150 },
				{ field: "hasArrived", title: "@Resources.ArriveStatus", align: "center", sortable: true, width: 250 },
				{ field: "hasPrinted", title: "@Resources.AttendCard", align: "center", sortable: true, width: 150 },
				{ field: "hasDinner", title: "@Resources.DinnerStatus", align: "center", sortable: true, width: 150 },
				{ field: "hasInvoiced", title: "@Resources.Invoice", align: "center", sortable: true, width: 150 },
				{ field: "hasSendPaid", title: "@Resources.SendStatus", align: "center", sortable: true, width: 150 },
			]],
			onBeforeLoad: function (param) {
				param.conferenceId = $("#hidConferenceId").val();
				param.random = Math.random();
			},
		});

		$(window).resize(function () {
			$("#dataGrid").datagrid("resize", {
				width: $(window).width() - 285,
				height: $(window).height() - 158
			});
		});

		$("#detailWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			top: 100
		});

		$("#invoiceWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			height: 800,
			top: 100
		});

		$("#profilePrintView").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			height: 800,
			top: 100
		});

		$("#paymentDetailWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			top: ($(window).height() - 600) * 0.5
		});

		$("#printView").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			height: 800,
			top: 100
		});

		$("#importWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			top: ($(window).height() - 600) * 0.5
		});

		$("#paymentHasPay").numberbox({
			onChange: function(value) {
				if (value == 0) {
					$("#payStatus").combobox("setValue", "@ConstValues.PaidStatus.未缴费");
				} else {
					$("#payStatus").combobox("setValue", "@ConstValues.PaidStatus.已缴费");
				}
			}
		});

		$("#payStatus").combobox({
			onChange: function(value) {
				if (value == "@ConstValues.PaidStatus.未缴费") {
					$("#payStatus").siblings().find(":text").css("color", "red");
					$("#btnMail").hide();
				} else {
					$("#payStatus").siblings().find(":text").css("color", "#333");
					$("#btnMail").show();
				}
			}
		});

		$("#arriveStatus").combobox({
			onChange: function(value) {
				if (value == "@ConstValues.GenericSelectionType.无") {
					$("#arriveStatus").siblings().find(":text").css("color", "red");
				} else {
					$("#arriveStatus").siblings().find(":text").css("color", "#333");
				}
			}
		});

		$("#dinnerStatus").combobox({
			onChange: function(value) {
				if (value == "@ConstValues.GenericSelectionType.无") {
					$("#dinnerStatus").siblings().find(":text").css("color", "red");
				} else {
					$("#dinnerStatus").siblings().find(":text").css("color", "#333");
				}
			}
		});

		$("#attendCardPrint").combobox({
			onChange: function(value) {
				if (value == "@ConstValues.GenericSelectionType.无") {
					$("#attendCardPrint").siblings().find(":text").css("color", "red");
				} else {
					$("#attendCardPrint").siblings().find(":text").css("color", "#333");
				}
			}
		});

		$("#txtInvoiceTitle").combobox({
			url: "@Url.Action(nameof(UtilityController.GetInvoiceInfo), nameof(UtilityController).GetControllerName())",
			valueField: "invoiceTitle",
			textField: "invoiceTitle",
			panelHeight: "auto",
			hasDownArrow: false,
			onChange: function (n,o) {
				$("#txtTaxNum").textbox("setValue", "");
				$("#txtAddressAndTel").textbox("setValue", "");
				$("#txtBank").textbox("setValue", "");
				$("#txtBankAccount").textbox("setValue", "");
			},
			onSelect: function (rec) {
				$("#txtTaxNum").textbox("setValue", rec.taxNum);
				$("#txtAddressAndTel").textbox("setValue", rec.addressAndTel);
				$("#txtBank").textbox("setValue", rec.bank);
				$("#txtBankAccount").textbox("setValue", rec.bankAccount);
			},
			onLoadSuccess: function(data) {
				orgCount = data.length;
			},
			onShowPanel: function () {
				if (orgCount < 10) {
					$(this).combobox("panel").height("auto");
				} else {
					$(this).combobox("panel").height(200);
				}
			},
			onHidePanel: function () { }
		});

		$("#txtInvoiceNum").textbox({
			onChange: function(value) {
				if (value != "") {
					$("input[name='HasInvoiced'][value='true']").prop("checked", true);
				} else {
					$("input[name='HasInvoiced'][value='false']").prop("checked", true);
				}
			}
		});
	});

	function searchData() {
		$("#dataGrid").datagrid("load", {
			selSearchId: $("#selSearchId").textbox("getValue"),
			selId: $("#selId").textbox("getValue"),
			selPaidStatus: $("#selPaidStatus").combobox("getValue"),
			selArriveStatus: $("#selArriveStatus").combobox("getValue"),
			selDinnerStatus: $("#selDinnerStatus").combobox("getValue"),
			selInvoiceStatus: $("#selInvoiceStatus").combobox("getValue"),
			selPaidType:  $("#selPaidType").combobox("getValue"),
		});
	}

	/*会议现场管理*/
	function localeManage() {
		$("#hdnWindowType").val("localeManage");
		$("#txtId").val("");
		$("#txtId").removeAttr("disabled","disabled")

		$("#fullName").textbox("setValue","");
		$("#paymentShouldPay").textbox("setValue","");
		$("#paymentHasPay").textbox("setValue","");

		$("#paymentType").combobox({
			url: "@Url.Action(nameof(UtilityController.GetPhysicalPayType),
					nameof(UtilityController).GetControllerName())" + "?conferenceId=" + "@Model.ConferenceId",
			valueField: "id",
			textField: "name",
			required: true,
			editable: false,
			panelHeight: "auto",
		});

		$("#paymentType").combobox("setValue","");
		$("#payStatus").combobox("setValue","");
		$("#arriveStatus").combobox("setValue","");
		$("#dinnerStatus").combobox("setValue","");
		$("#attendCardPrint").combobox("setValue","");
		$("#invoiceNum").textbox("setValue","");
		$("#remark").textbox("setValue","");
		$("#btnMail").hide();

		$("#detailWindow").window("open");
	}

	/*扫码*/
	function scan(){
		var id = $("#txtId").val();
		if (id.length == 22) {
			var url = "@Url.Action(nameof(ConferenceLocaleController.GetScanData),
					nameof(ConferenceLocaleController).GetControllerName())?id="+id;
			$.get(url, null, function (data, textStatus, jqXHR) {
				if (data.result == "@ConstValues.AjaxFailResult") {
					common.showError(data.message);
				} else {
					$("#fullName").textbox("setValue",data.data.fullName);
					$("#paymentShouldPay").textbox("setValue", data.data.paymentShouldPay);
					$("#paymentHasPay").textbox("setValue", data.data.paymentHasPay);

					$("#paymentType").combobox("setValue", data.data.paymentType);
					$("#payStatus").combobox("setValue", data.data.payStatus);
					$("#arriveStatus").combobox("setValue", data.data.arriveStatus);
					$("#dinnerStatus").combobox("setValue", data.data.dinnerStatus);
					$("#attendCardPrint").combobox("setValue", data.data.attendCardPrint);
					$("#invoiceNum").textbox("setValue", data.data.invoiceNum);
					$("#remark").textbox("setValue", data.data.remark);
					if (data.data.payStatus == "@ConstValues.PaidStatus.未缴费") {
						$("#btnMail").hide();
					} else {
						$("#btnMail").show();
					}
					$("#txtId").select();
				}
			});
		}
	}

	function localeManageById(id){
		var url = "@Url.Action(nameof(ConferenceLocaleController.GetLocaleDataById),
				nameof(ConferenceLocaleController).GetControllerName())" + "/" + id;
		$.get(url, null, function (data, textStatus, jqXHR) {
			if (data.result == "@ConstValues.AjaxFailResult") {
				common.showError(data.message);
			} else {
				$("#hdnWindowType").val("localeManageById");
				$("#txtId").val(id);
				$("#txtId").attr("disabled","disabled");
				$("#hidAttendId").val(id);

				$("#fullName").textbox("setValue",data.data.fullName);
				$("#paymentShouldPay").textbox("setValue",data.data.paymentShouldPay);
				$("#paymentHasPay").textbox("setValue",data.data.paymentHasPay);

				$("#paymentType").combobox({
					url: "@Url.Action(nameof(UtilityController.GetPhysicalPayType),
							nameof(UtilityController).GetControllerName())" + "?conferenceId=" + "@Model.ConferenceId",
					valueField: "id",
					textField: "name",
					required: true,
					editable: false,
					panelHeight: "auto",
				});

				$("#paymentType").combobox("setValue", data.data.paymentType);
				$("#payStatus").combobox("setValue", data.data.payStatus);
				$("#arriveStatus").combobox("setValue", data.data.arriveStatus);
				$("#dinnerStatus").combobox("setValue", data.data.dinnerStatus);
				$("#attendCardPrint").combobox("setValue", data.data.attendCardPrint);
				$("#invoiceNum").textbox("setValue", data.data.invoiceNum);
				$("#remark").textbox("setValue", data.data.remark);
				if (data.data.payStatus == "@ConstValues.PaidStatus.未缴费") {
					$("#btnMail").hide();
				} else {
					$("#btnMail").show();
				}
				$("#detailWindow").window("open");
			}
		});
	}

	function invoiceManageById(id) {
		var url = "@Url.Action(nameof(ConferenceLocaleController.GetInvoiceManageById),
				nameof(ConferenceLocaleController).GetControllerName())" + "/" + id;
		$.get(url, null, function (data, textStatus, jqXHR) {
			if (data.result == "@ConstValues.AjaxFailResult") {
				common.showError(data.message);
			} else {
				$("#i-hdnWindowType").val("localeManageById");
				$("#i-hidId").val(id);
				$("#i-hidConferenceId").val("@Model.ConferenceId");
				$("#txtInvoiceNum").textbox("setValue", data.data.invoiceNum);

				if (data.data.hasInvoiced == true) {
					$("input[name='HasInvoiced'][value='true']").prop("checked",true);
				} else {
					$("input[name='HasInvoiced'][value='false']").prop("checked",true);
				}

				$("#txtInvoiceTitle").combobox("setValue", data.data.invoiceTitle);
				$("#txtInvoiceTitle").combobox("setText", data.data.invoiceTitle);
				$("#txtTaxNum").textbox("setValue", data.data.taxNum);
				$("#txtAddressAndTel").textbox("setValue", data.data.addressAndTel);
				$("#txtBank").textbox("setValue", data.data.bank);
				$("#txtBankAccount").textbox("setValue",data.data.bankAccount);

				$("#txtInvoiceType").textbox("setValue", data.data.invoiceType);
				$("#txtInvoiceClass").textbox("setValue", data.data.invoiceClass);
				$("#txtInvoiceDate").textbox("setValue", data.data.invoiceDate);
				$("#txtInvoiceCode").textbox("setValue", data.data.invoiceCode);
				$("#txtInvoiceAmount").numberbox("setValue", data.data.invoiceAmount);
				$("#txtInvoiceAddress").textbox("setValue", data.data.invoiceAddress);
				$("#txtInvoiceReceive").textbox("setValue", data.data.invoiceReceive);
				$("#txtInvoiceTel").textbox("setValue", data.data.invoiceTel);
				$("#txtInvoiceExpress").textbox("setValue", data.data.invoiceExpress);
				$("#txtInvoiceMail").textbox("setValue", data.data.invoiceMail);

				$("#invoiceWindow").window("open");
			}
		});
	}

	function checkPaymentDetail(id) {
		$("#paymentDataGrid").datagrid({
			url: "@Url.Action(nameof(ConferenceLocaleController.GetPaymentInfoData),
					nameof(ConferenceLocaleController).GetControllerName())" + "/" + id,
			method: "get",
			singleSelect: true,
			fitColumns: true,
			nowrap: false,
			pagination: false,
			pageSize: 10,
			striped: true,
			columns: [[
				{ field: "feeType", title: "@Resources.FeeType", align: "center", width: 100 },
				{ field: "feeName", title: "@Resources.FeeName", align: "center", width: 300 },
				{ field: "count", title: "@Resources.Count", align: "center", width: 40 },
				{ field: "currency", title: "@Resources.Currency", align: "center", width: 100 },
				{ field: "fee", title: "@Resources.Fee", align: "center", width: 100 },
				{ field: "discount", title: "@Resources.Discount", align: "center", width: 100 },
			]]
		});
		$("#paymentDetailWindowTitle").text("@Resources.PaymentDetail");
		$("#paymentDetailWindow").window("open");
	}

	function saveData(){
		var isValid = $("#frmDetail").form("validate");

		if (isValid) {
			$.messager.confirm("@Resources.Save", "@Resources.CfmSave", function (r) {
				if (r) {
					var loading = layer.load(0,  {
						shade: [0.4,"#fff"]
					});
					$.post("@Url.Action(nameof(ConferenceLocaleController.SaveLocaleManage),
							nameof(ConferenceLocaleController).GetControllerName())",
						$("#frmDetail").serialize(),
						function(data, textStatus, jqXHR) {
							layer.close(loading);
							if (data.result == "@ConstValues.AjaxFailResult") {
								common.showError(data.message);
							} else {
								common.showSuccess(data.message, true);
								$("#detailWindow").window("close");
								$("#dataGrid").datagrid("reload");
							}
						}
					);
				}
			});
		}
	}

	function sendMail(){
		var isValid = $("#frmDetail").form("validate");

		if (isValid) {
			$.messager.confirm("@Resources.Save", "@Resources.CfmSaveAndSend", function (r) {
				if (r) {
					var loading = layer.load(0,  {
						shade: [0.4,"#fff"]
					});
					$.post("@Url.Action(nameof(ConferenceLocaleController.SaveLocaleManageSendMail),
							nameof(ConferenceLocaleController).GetControllerName())",
						$("#frmDetail").serialize(),
						function(data, textStatus, jqXHR) {
							layer.close(loading);
							if (data.result == "@ConstValues.AjaxFailResult") {
								common.showError(data.message);
							} else {
								common.showSuccess(data.message, true);
								$("#detailWindow").window("close");
								$("#dataGrid").datagrid("reload");
							}
						}
					);
				}
			});
		}
	}

	function saveInvoice() {
		var isValid = $("#invoiceDetail").form("validate");
		if (isValid) {
			var loading = layer.load(0,  {
				shade: [0.4,"#fff"]
			});
			$.post("@Url.Action(nameof(ConferenceLocaleController.SaveInvoiceInfo),
					nameof(ConferenceLocaleController).GetControllerName())",
				$("#invoiceDetail").serialize(),
				function(data, textStatus, jqXHR) {
					layer.close(loading);
					if (data.result == "@ConstValues.AjaxFailResult") {
						common.showError(data.message);
					} else {
						common.showSuccess(data.message, true);
						$("#invoiceWindow").window("close");
						$("#dataGrid").datagrid("reload");
					}
				}
			);
		}
	}

	//print card
	function printData() {
		var id = $("#txtId").val()
		if (id == null || id == "") {
			common.showError("@Resources.MsgNoAttendIdInputError");
			return;
		}
		var url = "@Url.Action(nameof(ConferenceLocaleController.PrintView), nameof(ConferenceLocaleController).GetControllerName())"+"/"+id
		$("#p-iframe").attr("src",url)
		$("#attendCardPrint").combobox("setValue","@ConstValues.GenericSelectionType.有")
		$("#printView").window("open");
	}

	function PrintViewClose(){
		$("#printView").window("close");
	}

	//print personal data
	function printPersonData(id) {
		var url = "@Url.Action(nameof(ConferenceLocaleController.ProfilePrintView), nameof(ConferenceLocaleController).GetControllerName())"+"/"+id
		$("#profile-iframe").attr("src",url);
		$("#profilePrintView").window("open");
	}

	function ProfilePrintViewClose() {
		$("#profilePrintView").window("close");
	}

	function downloadImportTemplate() {
		var url = "@Url.Action(nameof(ConferenceLocaleController.DownloadImportTemplate),
				nameof(ConferenceLocaleController).GetControllerName())";
		$("#iframeDownload").attr("src", url);
	}

	function openImport() {
		$("#importWindow").window("open");
	}

	function importData() {
		var loading = layer.load(0,  {
			shade: [0.4,"#fff"]
		});

		$("#frmImport").form({
			iframe: false,
			success: function (data) { }
		});

		$("#hidIptConferenceId").val("@Model.ConferenceId");
		$("#frmImport").form("submit", {
			url: "@Url.Action(nameof(ConferenceLocaleController.Import), nameof(ConferenceLocaleController).GetControllerName(),
				new { ConferenceId = Model.ConferenceId })",
			onSubmit: function (param) {
				param.random = Math.random();
			},
			success: function (data) {
				layer.close(loading);
				data = JSON.parse(data);
				switch (data.result) {
					case "@ConstValues.AjaxSuccessResult":
						$("#importWindow").window("close");
						if (data.message == "@Resources.SuccessImport") {
							common.showSuccess(data.message, true);
						} else {						
							var reg = new RegExp( "\n" , "g" )
							var msg = data.message.replace(reg , "<br />" );
							$.messager.alert
							({
								title: "@Resources.Note",
								msg: '<div style="max-height:100px;">' + msg + '</div>',
								width: 600
							});
						}
						$("#dataGrid").datagrid("reload");
						break;

					case "@ConstValues.AjaxFailResult":
						common.showError(data.message);
						$("#dataGrid").datagrid("reload");
						break;
				}
			}
		});
	}
</script>
}